package com.eliansun.crawler.pageparse;

import com.eliansun.crawler.spider.MySpider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;

/**
 * xpq
 * 2017/4/14
 */
public class AbstractPageProcess implements PageProcessor {

    Logger logger = LoggerFactory.getLogger(getClass());

    protected String wordKey;
    protected String main_Url;
    protected String provinceName;
    protected  String cTerrace;

    public String getcTerrace() {
        return cTerrace;
    }

    public void setcTerrace(String cTerrace) {
        this.cTerrace = cTerrace;
    }

    protected MySpider mySpider;

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public void setWordKey(String wordKey) {
        this.wordKey = wordKey;
    }

    public void setMain_Url(String main_Url) {
        this.main_Url = main_Url;
    }

    @Override
    public void  process(Page page) {

    }

    @Override
    public Site getSite() {
        return null;
    }

    public void test(){};

    public void setMySpider(MySpider mySpider) {
        this.mySpider = mySpider;
    }


    public void close() {
        if (mySpider != null) {
            mySpider.stop();
            mySpider = null;
        } else {
            logger.error("spider未赋值。。");
        }
    }

}
